package blog.service.client.impl;

import blog.dao.client.CollectClientMapper;
import blog.dao.client.ThumbClientMapper;
import blog.entity.Collect;
import blog.entity.Thumb;
import blog.service.client.CollectClientService;
import blog.service.client.ThumbClientService;
import blog.vo.client.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 　　* @description: TODO
 * 　　* @param
 * 　　* @return
 * 　　* @throws
 * 　　* @author Administrator
 * 　　* @date $ $
 *
 */
@Service
public class CollectClientServiceImpl implements CollectClientService {
    @Autowired
    private CollectClientMapper collectClientMapper;

    @Override
    public int collectCount(CollectCountVO collectCountVO) {
        return collectClientMapper.collectCount(collectCountVO.getBlogUuid());
    }

    @Override
    public int addCollect(AddCollectVO addCollectVO) {
        return collectClientMapper.addCollect(addCollectVO.getBlogUuid(),addCollectVO.getCollectUuid(),addCollectVO.getCollectName());
    }

    @Override
    public int isAddCollect(CollectVO collectVO) {
        Collect collect = collectClientMapper.isAddCollect(collectVO.getBlogUuid(),collectVO.getCollectUuid());
        if (collect == null){
            return 0;
        }
        else {
            return 1;
        }
    }

    @Override
    public int cancelAddCollect(CollectVO collectVO) {
        return collectClientMapper.cancelAddCollect(collectVO.getBlogUuid(),collectVO.getCollectUuid());
    }
}
